const judgeF = (e) => {
  let res = e;
  let str = "";
  if (e.showType == "text") {
    if (e.fill == "text") {
      res["textInfo"] = res.textInfo.filter((v) => v.label || v.value);
      if (!e.title && res["textInfo"].length == 0) {
        str = "文本内容请最少输入一项内容";
      }
    } else if (e.fill == "table") {
      //
      res["tableHead"] = res.tableHead.filter((v) => v.title);
      res["tableData"] = res.tableData.filter((v) => Object.keys(v).length > 1);
      if (res["tableHead"].length == 0) {
        str = "表格列最少添加一项并且输入列名称";
      } else if (res["tableData"].length == 0) {
        str = "表格数据最少添加一项并且输入各项名称";
      }
    }
  } else if (e.showType == "picture") {
    if (e.images.length == 0) {
      str = "请最少上传一张图片";
    }
  } else if (e.showType == "textAndPicture") {
    if (e.images.length == 0) {
      str = "请最少上传一张图片";
    } else if (e.fill == "text") {
      res["textInfo"] = res.textInfo.filter((v) => v.label || v.value);
      if (!e.title && res["textInfo"].length == 0) {
        str = "文本内容请最少输入一项内容";
      }
    } else if (e.fill == "table") {
      //
      res["tableHead"] = res.tableHead.filter((v) => v.title);
      res["tableData"] = res.tableData.filter((v) => Object.keys(v).length > 1);
      if (res["tableHead"].length == 0) {
        str = "表格列最少添加一项并且输入列名称";
      } else if (res["tableData"].length == 0) {
        str = "表格数据最少添加一项并且输入各项名称";
      }
    }
  }
  return str || res;
};
export { judgeF };
